package com.itheima.ai.config;

import com.itheima.ai.config.component.agent.tool.*;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.ToolCallbacks;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.Objects;

/**
 * 集中的工具注册类
 */
@Configuration
public class ToolRegistration {
    @Value("${spring.ai.openai.tool.options.model}")
    private String searchApiKey;

    @Bean
    public ToolCallback[] allTools() {
        Object[] toolArray = new Object[] {
                new FileOperationTool(),
                new WebSearchTool(searchApiKey),
                new WebScrapingTool(),
                new ResourceDownloadTool(),
                new TerminalOperationTool(),
                new PDFGenerationTool(),
                new TerminateTool()
        };

        return ToolCallbacks.from(toolArray);
    }
}
